
<cfcomponent displayname="customer" output="false" extends="transfer.com.TransferDecorator">
	<cfproperty name="cust_notes" type="string" default="" />
	<cfproperty name="cus_sysid" type="numeric" default="" />
	<cfproperty name="cus_name_first" type="string" default="" />
	<cfproperty name="cus_name_last" type="string" default="" />
	<cfproperty name="cus_full_name" type="string" default="" />
	<cfproperty name="cus_address" type="string" default="" />
	<cfproperty name="cus_city" type="string" default="" />
	<cfproperty name="cus_state" type="string" default="" />
	<cfproperty name="cus_zip_code" type="string" default="" />
	<cfproperty name="cus_zip_plus" type="string" default="" />
	<cfproperty name="cus_areacode" type="numeric" default="" />
	<cfproperty name="cus_phonenum" type="numeric" default="" />
	<cfproperty name="cus_first_contact" type="numeric" default="" />
	<cfproperty name="cus_notes_q" type="boolean" default="" />
	
	<cffunction name="validate" access="public" returntype="array" output="false">
		<cfset var errors = arrayNew(1) />
		<cfset var thisError = structNew() />
		
		<!--- cust_notes --->
		<cfif (len(trim(getcust_notes())) AND NOT IsSimpleValue(trim(getcust_notes())))>
			<cfset thisError.field = "cust_notes" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cust_notes is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcust_notes())) GT 65535)>
			<cfset thisError.field = "cust_notes" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cust_notes is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_sysid --->
		<cfif (len(trim(getcus_sysid())) AND NOT isNumeric(trim(getcus_sysid())))>
			<cfset thisError.field = "cus_sysid" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_sysid is not numeric" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_name_first --->
		<cfif (len(trim(getcus_name_first())) AND NOT IsSimpleValue(trim(getcus_name_first())))>
			<cfset thisError.field = "cus_name_first" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_name_first is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_name_first())) GT 15)>
			<cfset thisError.field = "cus_name_first" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_name_first is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_name_last --->
		<cfif (len(trim(getcus_name_last())) AND NOT IsSimpleValue(trim(getcus_name_last())))>
			<cfset thisError.field = "cus_name_last" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_name_last is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_name_last())) GT 20)>
			<cfset thisError.field = "cus_name_last" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_name_last is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_full_name --->
		<cfif (len(trim(getcus_full_name())) AND NOT IsSimpleValue(trim(getcus_full_name())))>
			<cfset thisError.field = "cus_full_name" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_full_name is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_full_name())) GT 25)>
			<cfset thisError.field = "cus_full_name" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_full_name is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_address --->
		<cfif (len(trim(getcus_address())) AND NOT IsSimpleValue(trim(getcus_address())))>
			<cfset thisError.field = "cus_address" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_address is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_address())) GT 25)>
			<cfset thisError.field = "cus_address" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_address is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_city --->
		<cfif (len(trim(getcus_city())) AND NOT IsSimpleValue(trim(getcus_city())))>
			<cfset thisError.field = "cus_city" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_city is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_city())) GT 15)>
			<cfset thisError.field = "cus_city" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_city is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_state --->
		<cfif (len(trim(getcus_state())) AND NOT IsSimpleValue(trim(getcus_state())))>
			<cfset thisError.field = "cus_state" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_state is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_state())) GT 2)>
			<cfset thisError.field = "cus_state" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_state is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_zip_code --->
		<cfif (len(trim(getcus_zip_code())) AND NOT IsSimpleValue(trim(getcus_zip_code())))>
			<cfset thisError.field = "cus_zip_code" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_zip_code is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_zip_code())) GT 5)>
			<cfset thisError.field = "cus_zip_code" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_zip_code is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_zip_plus --->
		<cfif (len(trim(getcus_zip_plus())) AND NOT IsSimpleValue(trim(getcus_zip_plus())))>
			<cfset thisError.field = "cus_zip_plus" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_zip_plus is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getcus_zip_plus())) GT 4)>
			<cfset thisError.field = "cus_zip_plus" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "cus_zip_plus is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_areacode --->
		<cfif (len(trim(getcus_areacode())) AND NOT isNumeric(trim(getcus_areacode())))>
			<cfset thisError.field = "cus_areacode" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_areacode is not numeric" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_phonenum --->
		<cfif (len(trim(getcus_phonenum())) AND NOT isNumeric(trim(getcus_phonenum())))>
			<cfset thisError.field = "cus_phonenum" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_phonenum is not numeric" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_first_contact --->
		<cfif (len(trim(getcus_first_contact())) AND NOT isNumeric(trim(getcus_first_contact())))>
			<cfset thisError.field = "cus_first_contact" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_first_contact is not numeric" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- cus_notes_q --->
		<cfif (len(trim(getcus_notes_q())) AND NOT isBoolean(trim(getcus_notes_q())))>
			<cfset thisError.field = "cus_notes_q" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "cus_notes_q is not boolean" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<cfreturn errors />
	</cffunction>

</cfcomponent>
